package com.gdzn.signal.factory;

import com.gdzn.common.core.domain.R;
import com.gdzn.signal.service.RemoteSignalService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;


/**
 * 日志服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class RemoteSignalFallbackFactory implements FallbackFactory<RemoteSignalService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteSignalFallbackFactory.class);

    @Override
    public RemoteSignalService create(Throwable throwable)
    {
        log.error("报文数据处理失败:{}", throwable.getMessage());
        return new RemoteSignalService()
        {
            @Override
            public void insert(String paramMap) {
                log.info("保存报文数据失败");
            }

            @Override
            public R<Boolean> updateCabinetOnline(String devId, String online) {
                return R.fail("修改电柜在线或离线状态失败:" + throwable.getMessage());
            }

        };

    }
}
